{extend name="/fool" /}
{block name="menu_content"}
<style>
    #content .li{
        float:left;
        width:90vw;
        margin: 5vh 5vw;
    }
    .value{
        display: block;
        margin:1vh 0;
    }
    #content .one .one-one{
        text-align: right;
    }
    tr{
        line-height: 50px;
    }
    #groupadd{
        background:#fff;
        border-radius: 10px;
        z-index:20;
        position: absolute;
        width:300px;
        height: 250px;
        top:50%;
        left:50%;
        margin-left:-250px;
        margin-top:-200px;
        display: none;
        border:1px solid rgba(0,0,0,0.5);
    }
    #groupadds{
        background:#fff;
        border-radius: 10px;
        z-index:20;
        position: absolute;
        width:300px;
        height: 250px;
        top:50%;
        left:50%;
        margin-left:-250px;
        margin-top:-200px;
        display: none;
        border:1px solid rgba(0,0,0,0.5);
    }
    #groupjian{
        background:#fff;
        border-radius: 10px;
        z-index:20;
        position: absolute;
        width:300px;
        height: 250px;
        top:50%;
        left:50%;
        margin-left:-250px;
        margin-top:-200px;
        display: none;
        border:1px solid rgba(0,0,0,0.5);
    }
    #groupjians{
        background:#fff;
        border-radius: 10px;
        z-index:20;
        position: absolute;
        width:300px;
        height: 250px;
        top:50%;
        left:50%;
        margin-left:-250px;
        margin-top:-200px;
        display: none;
        border:1px solid rgba(0,0,0,0.5);
    }
    #money{
        display: block;
        width:80%;
        margin: 20px auto;
    }
    #moneyjian{
        display: block;
        width:80%;
        margin: 20px auto;
    }
    #pd{
        display: none;
    }
    #pdjian{
        display: none;
    }
    #tjr{
    	display: none;
    }
</style>
<div id="groupadd">
    <div style="font-weight:bold;text-align: center;padding:20px 0;margin:0 20px;font-size: 18px;">增加额度</div>
    <form class="layui-form" action="" method="post" id="edtj">
        <div>
            <div>
                <input type="hidden" name="po" autocomplete="off" class="layui-input" value="1">
                <input id="money" type="text" name="loan" autocomplete="off" class="layui-input" placeholder="输入增加的额度">
            </div>
            <div style="text-align: center;margin-bottom: 30px;">
                 <span id="pd">不能为空</span>
            </div>
            <div style="width: 80%;margin: 0 auto;">
                <button style="float: left;margin-left:30px;" type="button" class="qx layui-btn">取消</button>
                <button style="float: right;margin-right:30px;" type="button" class="addform layui-btn">确认</button>
            </div>
        </div>
    </form>
</div>
<div id="groupadds">
    <div style="font-weight:bold;text-align: center;padding:20px 0;margin:0 20px;font-size: 18px;">操作确认</div>
    <form class="layui-form" action="" method="post">
        <div>
            <div style="text-align: center;margin:20px 0 50px 0;">
                确认执行之前所做操作
            </div>
            <div style="width: 80%;margin: 0 auto;">
                <button style="float: left;margin-left:30px;" type="button" class="qxs layui-btn">取消</button>
                <button style="float: right;margin-right:30px;" type="button" class="addforms layui-btn">确认</button>
            </div>
        </div>
    </form>
</div>
<div id="groupjian">
    <div style="font-weight:bold;text-align: center;padding:20px 0;margin:0 20px;font-size: 18px;">减少额度</div>
    <form class="layui-form" action="" method="post" id="edjs">
        <div>
            <div>
                <input type="hidden" name="po" autocomplete="off" class="layui-input" value="2">
                <input id="moneyjian" type="text" name="loan" autocomplete="off" class="layui-input" placeholder="输入增加的额度">
            </div>
            <div style="text-align: center;margin-bottom: 30px;">
                <span id="pdjian">不能为空</span>
            </div>
            <div style="width: 80%;margin: 0 auto;">
                <button style="float: left;margin-left:30px;" type="button" class="jianqx layui-btn">取消</button>
                <button style="float: right;margin-right:30px;" type="button" class="jianform layui-btn">确认</button>
            </div>
        </div>
    </form>
</div>
<div id="groupjians">
    <div style="font-weight:bold;text-align: center;padding:20px 0;margin:0 20px;font-size: 18px;">操作确认</div>
    <form class="layui-form" action="" method="post">
        <div>
            <div style="text-align: center;margin:20px 0 50px 0;">
                确认执行之前所做操作
            </div>
            <div style="width: 80%;margin: 0 auto;">
                <button style="float: left;margin-left:30px;" type="button" class="jianqxs layui-btn">取消</button>
                <button style="float: right;margin-right:30px;" type="button" class="jianforms layui-btn">确认</button>
            </div>
        </div>
    </form>
</div>
<div style="margin: 50px 0 0 50px;">
    <button type="button" class="jbxx layui-btn layui-btn-primary" style="border-color: #1989FA;color: #1989FA;">基本信息</button>
    <button type="button" class="qbjl layui-btn layui-btn-primary">钱包记录</button>
    <button type="button" class="jfjl layui-btn layui-btn-primary">积分记录</button>
    <button type="button" class="tdcy layui-btn layui-btn-primary">团队成员</button>
</div>
<form class="layui-form" action="" method="post">
<div id="tjr" style="position:absolute;width:200px;height:150px;left:50%;top:50%;background:#fff;margin-left:-100px;margin-top:-75px;border-radius:10px;box-shadow:0 0 5px 0 rgba(0,0,0,0.5)">
	<div class="layui-form-item" style="text-align:center;padding:20px;">
      <select name="parent_id" lay-verify="required">
        <option value=""></option>
        {foreach $user as $v}
        {if $v.id == $list.parent_id}
        <option value="{$v.id}" selected>{$v.name}</option>
        {else}
        <option value="{$v.id}">{$v.name}</option>
        {/if}
        {/foreach}
      </select>
      <button type="button" class="pqx layui-btn layui-btn-primary" style="margin-top:20px;">取消</button>
      <button type="submit" class="layui-btn layui-btn-primary" style="margin-top:20px;">保存</button>
  </div>
</div>
</form>
<script>
//Demo
layui.use('form', function(){
  var form = layui.form;
  
  //监听提交
  form.on('submit(formDemo)', function(data){
    layer.msg(JSON.stringify(data.field));
    return false;
  });
});
</script>
<ul id="content">
    <li class="li">
        <table class="one">
            <tr>
                <td class="one-one">用户ID：</td>
                <td class="value">{$list.id}</td>
            </tr>
            <tr>
                <td class="one-one">用户头像：</td>
                <td class="value">
                    {if $list.images}
                    <img style="width:100px;height:100px;border-radius: 50%;" src="{$list.images}" alt="">
                    {/if}
                </td>
            </tr>
            <tr>
                <td class="one-one">用户昵称：</td>
                <td class="value">{$list.name}</td>
            </tr>
            <tr>
                <td class="one-one">用户身份：</td>
                <td class="value">
                    {if $list.ptsf == 10}
                    普通用户
                    {elseif $list.ptsf == 1}
                    普通会员
                    {elseif $list.ptsf == 2}
                    {elseif $list.ptsf == 3 && $list.ptsf == 99}
                    普通代理商
                    {elseif $list.ptsf == 3 && $list.canpinsf != 99}
                        {if $list.canpinsf == 4}
                        产品区代理商
                        {elseif $list.canpinsf == 5}
                        产品市代理商
                        {elseif $list.canpinsf == 7}
                        产品省代理商
                        {/if}
                    {/if}
                </td>
            </tr>
            <tr>
                <td class="one-one">推荐人：</td>
                <td class="value" style="width:500px;">
                	{if isset($pa)}
                	<div class="layui-input-inline">
                	<input readonly="readonly" id="tjrs" type="text" name="parent_id" autocomplete="off" class="layui-input" value="{$pa.name}">
                	</div>
                	<button type="button" class="tjr layui-btn layui-btn-primary">修改推荐人</button>
                	{else}
                	<div class="layui-input-inline">
                	<input readonly="readonly" id="tjrs" type="text" name="parent_id" autocomplete="off" class="layui-input" placeholder="请选择推荐人">
                	</div>
                	<button type="button" class="tjr layui-btn layui-btn-primary">添加推荐人</button>
                	{/if}
                </td>
            </tr>
            <tr>
                <td class="one-one">姓名：</td>
                <td class="value">{$list.name}</td>
            </tr>
            <tr>
                <td class="one-one">联系电话：</td>
                <td class="value">{$list.phone}</td>
            </tr>
            <tr>
                <td class="one-one">身份证号：</td>
                <td class="value">{$list.number}</td>
            </tr>
            <tr>
                <td class="one-one">贷款额度：</td>
                <td class="value">
                    <span>{$list.loan}</span>
                    <button type="button" class="add layui-btn">增加</button>
                    <button type="button" class="delete layui-btn">减少</button>
                </td>
            </tr>
            <tr>
                <td class="one-one">
                    <button type="button" class="listbu layui-btn">返回</button>
                </td>
            </tr>
        </table>
    </li>
</ul>
<script>
	$(".tjr").click(function(){
		$("#tjr").show();
	})
	$(".pqx").click(function(){
		$("#tjr").hide();
	})
    console.log(123);
    var money = 0;
    $(".addform").click(function(){
        money = $("#money").val();
        if(money.length>0){
            var re=/^\+?[0-9][0-9]*$/;
            if(!re.test(money)){
                $("#pd").show();
                $("#pd").html('不是数字');
                return;
            }else{
                $("#pd").hide();
                $("#groupadd").hide();
                $("#groupadds").show();

            }
        }else{
            $("#pd").show();
        }
    })
    $(".addforms").click(function(){
        $("#groupadds").hide();
        $("#edtj").submit();
        console.log(money);
    })
    $(".jianform").click(function(){
        money = $("#moneyjian").val();
        if(money.length>0){
            var re=/^\+?[0-9][0-9]*$/;
            if(!re.test(money)){
                $("#pdjian").show();
                $("#pdjian").html('不是数字');
                return;
            }else{
                $("#pdjian").hide();
                $("#groupjian").hide();
                $("#groupjians").show();
            }
        }else{
            $("#pdjian").show();
        }
    })
    $(".jianforms").click(function(){
        $("#groupjians").hide();
        $("#edjs").submit();
        console.log(money);
    })
    $(".delete").click(function(){
        $("#groupjian").show();
    })
    $(".add").click(function(){
        $("#groupadd").show();
    })
    $(".qx").click(function(){
        $("#groupadd").hide();
    })
    $(".qxs").click(function(){
        $("#groupadds").hide();
    })
    $(".jianqx").click(function(){
        $("#groupjian").hide();
    })
    $(".jianqxs").click(function(){
        $("#groupjians").hide();
    })
    $(".listbu").click(function(){
        history.back(-1);
    })

    //用户基本信息
    $(".jbxx").click(function(){
        var url = "{:url('user/view')}" + '?battery_order=' + "{$list['id']}"
        location.href = url;
    })
    //用户钱包记录
    $(".qbjl").click(function(){
        var url = "{:url('wallet/index')}" + '?battery_order=' + "{$list['id']}"
        location.href = url;
    })
    //用户积分记录
    $(".jfjl").click(function(){
        var url = "{:url('integral/user')}" + '?battery_order=' + "{$list['id']}"
        location.href = url;
    })
    //用户团队成员
    $(".tdcy").click(function(){
        var url = "{:url('user/team')}" + '?battery_order=' + "{$list['id']}"
        location.href = url;
    })
</script>
{/block}